package by.dezhits.liltweets.adapter;

import android.content.Context;
import android.database.Cursor;
import android.support.v4.widget.CursorAdapter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import by.dezhits.liltweets.R;
import by.dezhits.liltweets.content.contract.PostContract;

public class DraftCursorAdapter extends CursorAdapter {
	
	public DraftCursorAdapter(Context context, Cursor c) {
		super(context, c, true);
	}

	@Override
	public void bindView(View oldView, Context context, Cursor cursor) {
		TextView tvText = (TextView) oldView.findViewById(R.id.tv_draft_text);
		TextView tvStatus = (TextView) oldView.findViewById(R.id.tv_draft_status);
		String text = cursor.getString(cursor.getColumnIndex(PostContract.PostColumns.TEXT));
		String status = cursor.getString(cursor.getColumnIndex(PostContract.PostColumns.STATUS));
		tvText.setText(text);
		tvStatus.setText(status);

}

	@Override
	public View newView(Context context, Cursor cursor, ViewGroup viewGroup) {
		View view = View.inflate(context, R.layout.adapter_draft, null);
		return view;
	}

}
